package edu.zut.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter(filterName = "LoginFilter",urlPatterns = "/*")
public class LoginFilter implements Filter {
    public void init(FilterConfig config) throws ServletException {
    }

    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        //登录的拦截
        //将需要拦截的资源统一拦截下来，判断用户是否登录，如果为登录，将返回登录页面，如果已登录，将放行
        //不需要拦截的就直接放行
        chain.doFilter(request, response);
    }
}
